package org.spring.boot.fusion;

import java.util.Collection;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.corundumstudio.socketio.SocketIOClient;
import com.corundumstudio.socketio.SocketIOServer;

@RestController
public class TestController {

	@Autowired
	private SocketIOServer socketIOServer;

	@GetMapping("test")
	public String test() {
		String string = UUID.randomUUID().toString();
		Collection<SocketIOClient> allClients = socketIOServer.getAllClients();
		for (SocketIOClient socket : allClients) {
			//这个名字是前端订阅的
			socket.sendEvent("text1", string);
		}
		return string;
	}

}
